const std = @import("std");

const c = @import("component.zig");
const s = @import("system.zig");
const r = @import("resource.zig");
const dispatcher = @import("dispatcher.zig");

var position_storage = c.PositionStorage.init();
var velocity_storage = c.VelocityStorage.init();
var entity_storage = c.EntityStorage.init();
var io_state = r.IO.init();

const resources = .{
    &position_storage,
    &velocity_storage,
    &entity_storage,
    &io_state,
};

const systems = .{
    s.movementSystem,
    s.debugSystem,
    s.ioSystem,
};

pub fn main() anyerror!void {
    try io_state.setup();

    const run = dispatcher.Dispatcher(systems, resources);

    const ITERATIONS = 2;
    var i: usize = 0;
    while (true) : (i += 1) {
        try run();
    }
}
